package vn.edu.uit.chemistry.view;

import vn.edu.uit.chemistry.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

public class ViewRowKiemTra15 extends AbstractView{
	
	TextView tvHoTen;
	TextView tvMSHS;
	TextView tvPercent;
	TextView tvFinish;
	ProgressBar prPercent;

	public ViewRowKiemTra15(Context context) {
		super(context);
		pContext = context;
		mInflater = LayoutInflater.from(pContext);
		layout = mInflater.inflate(R.layout.row_kiem_tra, null);
		
		tvHoTen = (TextView) layout.findViewById(R.id.tvHoTen);
		tvMSHS = (TextView) layout.findViewById(R.id.tvMSHS);
		tvPercent = (TextView) layout.findViewById(R.id.tvPercent);
		tvFinish = (TextView) layout.findViewById(R.id.tvFinish);
		prPercent = (ProgressBar) layout.findViewById(R.id.prPercent);
	}
	
	public void setContent(String hoten, String mshs, int percent, int daNop) {
		tvHoTen.setText(hoten);
		tvMSHS.setText(mshs);
		if (daNop == 0) {
			tvPercent.setText("" + percent + " %");
			prPercent.setProgress(percent);
			tvFinish.setVisibility(View.GONE);
		} else {
			tvPercent.setVisibility(View.GONE);
			prPercent.setVisibility(View.GONE);
			tvFinish.setVisibility(View.VISIBLE);
		}
		
	}
}
